-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit diagnostic when calling methods on the unit type in method chains #109116
Emit diagnostic when calling methods on the unit type in method chains #109116
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@rustbot label +A-diagnostics |
inlined and removed :) |
r=me after squashing commits. |
b3aaf68
to
6a2a6fe
Compare
@bors r=petrochenkov |
@MaciejWas: 🔑 Insufficient privileges: Not in reviewers |
@rustbot review |
@bors r=petrochenkov |
If no method is found when checking method call, we check if we called a method with signature (&mut T, ...) -> (). If this is the case then we emit a diagnostic message
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#108722 (Support for Fuchsia RISC-V target) - rust-lang#108880 (Remove tests/ui/impl-trait/in-trait/new-lowering-strategy in favor of using revisions on existing tests) - rust-lang#108909 (Fix object safety checks for new RPITITs) - rust-lang#108915 (Remove some direct calls to local_def_id_to_hir_id on diagnostics) - rust-lang#108923 (Make fns from other crates with RPITIT work for -Zlower-impl-trait-in-trait-to-assoc-ty) - rust-lang#109101 (Fall back to old metadata computation when type references errors) - rust-lang#109105 (Don't ICE for late-bound consts across `AnonConstBoundary`) - rust-lang#109110 (Don't codegen impossible to satisfy impls) - rust-lang#109116 (Emit diagnostic when calling methods on the unit type in method chains) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #104204.
What this PR does: If a method is not found somewhere in a call chain, we check if we called earlier a method with signature
(&mut T, ...) -> ()
. If this is the case then we emit a diagnostic message.For example given input:
the current output is:
after this PR it will be: